var findAndReplacePattern = function (words, pattern) {
    let ans = []
    words.forEach((word) => {
        let flag = true
        let one = {}
        let two = {}
        for (let i = 0; i < word.length && flag; i++) {
            if (!one[word.charAt(i)]) {
                one[word.charAt(i)] = pattern.charAt(i)
            }
            if (!two[pattern.charAt(i)]) {
                two[pattern.charAt(i)] = word.charAt(i)
            }
            if (two[pattern.charAt(i)] !== word.charAt(i) || one[word.charAt(i)] !== pattern.charAt(i)) {
                flag = false
            }
        }
        if (flag) {
            ans = [...ans, word]
        }
    })
    return ans
};

var heightChecker = function (heights) {
    let newHeights = [...heights]
    let ans = 0
    newHeights.sort((a, b) => a - b)
    newHeights.forEach((h, index) => {
        if (newHeights[index] !== heights[index]) {
            ans++
        }
    })
    return ans
};

var findPairs = function (nums, k) {
    if (k < 0) return 0
    let visited = new Set()
    let diff = new Set()
    nums.forEach((num) => {
        if (visited.has(num + k)) {
            diff.add(num)
        }
        if (visited.has(num - k)) {
            diff.add(num - k)
        }
        visited.add(num)
    })
    return diff.size
};

var duplicateZeros = function (arr) {
    const newArr = [...arr]
    let index = 0
    for (let i = 0; i < newArr.length; i++) {
        if (newArr[i] != 0) {
            arr[index++] = newArr[i]
        } else {
            arr[index++] = newArr[i]
            if (index < arr.length) {
                arr[index++] = newArr[i]
            }
        }
    }
};

var findBottomLeftValue = function (root) {
    let ans = 0
    let queue = [root]
    let start = 0
    while (start < queue.length) {
        ans = queue[start].val
        const size = queue.length
        for (let i = start; i < size; i++, start++) {
            const poll = queue[i]
            if (poll.left != null) {
                queue.push(poll.left)
            }
            if (poll.right != null) {
                queue.push(poll.right)
            }
        }
    }
    return ans
};

var largestValues = function (root) {
    let ans = []
    let queue = root === null ? [] : [root]
    let start = 0
    while (start < queue.length) {
        const size = queue.length
        let max = Number.MIN_VALUE
        for (let i = start; i < size; i++, start++) {
            const poll = queue[i]
            max = Math.max(max, poll.val)
            if (poll.left != null) {
                queue.push(poll.left)
            }
            if (poll.right != null) {
                queue.push(poll.right)
            }
        }
        ans = [...ans, max]
    }
    return ans
};

var wiggleSort = function (nums) {
    let ints = [...nums]
    nums.sort((a, b) => a - b)
    var length = nums.length;
    let index = length - 1
    for (let i = 1; i >= 0; i--) {
        for (let j = i; j < length; j += 2) {
            ints[j] = nums[index--]
        }
    }
    for (let i = 0; i < length; i++) {
        nums[i] = ints[i]
    }
};

const map = new Map()
/**
 * Encodes a URL to a shortened URL.
 *
 * @param {string} longUrl
 * @return {string}
 */
var encode = function (longUrl) {
    const hash = getHashCode(longUrl)
    const newUrl = 'http://tinyurl.com/4e9iAk' + hash
    map.set(newUrl, longUrl)
    return newUrl
};

/**
 * Decodes a shortened URL to its original URL.
 *
 * @param {string} shortUrl
 * @return {string}
 */
var decode = function (shortUrl) {
    return map.get(shortUrl)
};

/**
 * Your functions will be called as such:
 * decode(encode(url));
 */

//获取字符串的 哈希值
function getHashCode(str) {
    var hash = 1315423911, i, ch;
    for (i = str.length - 1; i >= 0; i--) {
        ch = str.charCodeAt(i);
        hash ^= ((hash << 5) + ch + (hash >> 2));
    }
    return (hash & 0x7FFFFFFF);
}

var minimumAbsDifference = function (arr) {
    Array.sort(arr)
    const map = new Map;
    let min = Number.MAX_VALUE
    for (let i = 0; i <= arr.length - 2; i++) {
        const number = Math.abs(arr[i] - arr[i + 1]);
        min = Math.min(number, min)
        if (map.contains(number)) {
            let newVar = map.get(number);
            newVar.push([arr[i], arr[i + 1]])
            map.set(number, newVar)
        } else {
            const list = []
            list.push([arr[i], arr[i + 1]])
            map.set(number, list)
        }
    }
    return map.get(min)
};

var MyCalendar = function () {
    this.book = []
};

/**
 * @param {number} start
 * @param {number} end
 * @return {boolean}
 */
MyCalendar.prototype.book = function (start, end) {
    for (let i = 0; i < this.book.length; i++) {
        const l = this.book[i][0]
        const r = this.book[i][1]
        if (l < end && start < r) {
            return false
        }
    }
    this.book = [...this.book, [start, end]]
    return true
};

/**
 * @param {number[]} position
 * @return {number}
 */
var minCostToMoveChips = function (position) {
    let even = 0
    let odd = 0
    position.forEach(num => {
        if (num % 2 === 0) {
            even++;
        } else {
            odd++;
        }
    })
    return Math.min(even, odd)
};

var MagicDictionary = function () {
    let dictionary = []
};

/**
 * @param {string[]} dictionary
 * @return {void}
 */
MagicDictionary.prototype.buildDict = function (dictionary) {
    this.dictionary = dictionary
};

/**
 * @param {string} searchWord
 * @return {boolean}
 */
MagicDictionary.prototype.search = function (searchWord) {
    let flag = false
    this.dictionary.forEach(d => {
        const length = searchWord.length
        if (d.length === length) {
            let diff = 0
            for (let i = 0; i < length; i++) {
                if (d.charAt(i) !== searchWord.charAt(i)) {
                    diff++
                }
            }
            if (diff === 1) {
                flag = true
                return
            }
        }
    })
    return flag;
};

var oddCells = function (m, n, indices) {
    let ints = new Array(m).fill(0).map(() => new Array(n).fill(0));
    let ans = 0
    indices.forEach(point => {
        const [r, c] = point
        for (let i = 0; i < ints[r].length; i++) {
            ints[r][i]++;
        }
        for (let i = 0; i < ints.length; i++) {
            ints[i][c]++;
        }
    })
    ints.forEach(i => {
        i.forEach(num => {
            if (num % 2 !== 0) {
                ans++;
            }
        })
    })
    return ans
};

/**
 * @param {number[]} asteroids
 * @return {number[]}
 */
var asteroidCollision = function (asteroids) {
    let ans = []
    asteroids.forEach(asteroid => {
        let active = true
        while (active && ans.length > 0 && asteroid < 0 && ans[ans.length - 1] > 0) {
            active = asteroid + ans[ans.length - 1] < 0
            if (asteroid + ans[ans.length - 1] <= 0) {
                ans.slice(0, ans.length - 1)
            }
        }
        if (active) {
            ans = [...ans, asteroid]
        }
    })
    return ans
};

/**
 * Initialize your data structure here.
 * @param {number} size
 */
var MovingAverage = function (size) {
    let nums = []
    let currentSize = size
    let all = 0
};

/**
 * @param {number} val
 * @return {number}
 */
MovingAverage.prototype.next = function (val) {
    this.nums = [...this.nums, val]
    this.all += val
    if (this.nums.length <= this.currentSize) {
        return this.all / this.nums.length
    } else {
        this.all -= this.nums[this.nums.length - this.currentSize - 1]
        return this.all / this.currentSize
    }
};

/**
 * Your MovingAverage object will be instantiated and called as such:
 * var obj = new MovingAverage(size)
 * var param_1 = obj.next(val)
 */

/**
 * @param {number[]} nums
 * @return {number}
 */
var arrayNesting = function (nums) {
    let max = 0
    for (let i = 0; i < nums.length; i++) {
        if (nums[i] === -1) continue
        let currentMax = 1
        let currentNum = nums[i]
        while (i != currentNum) {
            currentMax++
            const num = nums[currentNum]
            nums[currentNum] = -1
            currentNum = num
        }
        max = Math.max(max, currentMax)
    }
    return max
};

/**
 * @param {number[][]} grid
 * @param {number} k
 * @return {number[][]}
 */
var shiftGrid = function (grid, k) {
    const m = grid.length
    const n = grid[0].length
    let ints = new Array(m * n)
    let start = k % (m * n)
    for (let i = 0; i < m; i++) {
        for (let j = 0; j < n; j++) {
            if (start == m * n) {
                start = 0
            }
            ints[start++] = grid[i][j]
        }
    }
    let index = 0
    let ans = new Array(m)
    for (let i = 0; i < m; i++) {
        var inn = new Array(n);
        for (let j = 0; j < n; j++) {
            inn[j] = ints[index++]
        }
        ans[i] = inn
    }
    return ans
};

var pruneTree = function (root) {
    if (root == null) return null
    root.left = pruneTree(root.left)
    root.right = pruneTree(root.right)
    if (root.val === 0 && root.left == null && root.right == null) return null
    return root
};

function TreeNode(val, left, right) {
    this.val = (val === undefined ? 0 : val)
    this.left = (left === undefined ? null : left)
    this.right = (right === undefined ? null : right)
}

var CBTInserter = function (root) {
    this.root = root
    this.list = []
    let q = []
    this.list.push(root)
    q.push(root)
    while (q.length > 0) {
        let poll = q.shift()
        if (poll.left != null) {
            this.list.push(poll.left)
            q.push(poll.left)
        }
        if (poll.right != null) {
            this.list.push(poll.right)
            q.push(poll.right)
        }
        if (this.list[0].left && this.list[0].right) {
            this.list.shift()
        }
    }
};

/**
 * @param {number} val
 * @return {number}
 */
CBTInserter.prototype.insert = function (val) {
    let peek = this.list[0];
    let treeNode = new TreeNode(val);
    if (peek.left == null) {
        peek.left = treeNode;
    } else if (peek.right == null) {
        peek.right = treeNode;
        this.list.shift()
    }
    this.list.push(treeNode);
    return peek
};

/**
 * @return {TreeNode}
 */
CBTInserter.prototype.get_root = function () {
    return this.root
};

var arrayRankTransform = function (arr) {
    let ints = [...arr]

    let map = new Map()
    let start = 1
    ints.forEach(i => {
        if (!map.has(i)) {
            map.set(i, start)
            start++
        }
    })
    let ans = []
    arr.forEach(i => {
        ans.push(map.get(i))
    })
    return ans
};

var maxLevelSum = function (root) {
    let queue = [root]
    let max = root.val
    let step = 1
    let ans = 1
    while (queue.length > 0) {
        let size = queue.length;
        let all = 0;
        for (let i = 0; i < size; i++) {
            let node = queue[i];
            all += node.val
            if (node.left != null) {
                queue.push(node.left)
            }
            if (node.right != null) {
                queue.push(node.right)
            }
        }
        if (all > max) {
            max = all
            ans = step
        }
        step++
        queue.slice(size, queue.length)
    }
    return ans
};

var generateTheString = function (n) {
    if (n % 2 === 0) {
        return "a".repeat(n - 1) + "b"
    } else {
        "a".repeat(n)
    }
};

/**
 * @param {number} k
 */
var MyCircularQueue = function (k) {
    this.size = k
    this.queue = []
};

/**
 * @param {number} value
 * @return {boolean}
 */
MyCircularQueue.prototype.enQueue = function (value) {
    if (this.isFull()) {
        return false
    }
    this.queue.push(value)
    return true
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.deQueue = function () {
    if (this.isEmpty()) {
        return false
    }
    this.queue.slice(0, this.queue.length - 1)
    return true
};

/**
 * @return {number}
 */
MyCircularQueue.prototype.Front = function () {
    if (this.isEmpty()) {
        return -1
    }
    return this.queue[0]
};

/**
 * @return {number}
 */
MyCircularQueue.prototype.Rear = function () {
    if (this.isEmpty()) {
        return -1
    }
    return this.queue[this.queue.length - 1]
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.isEmpty = function () {
    return this.queue.length === 0
};

/**
 * @return {boolean}
 */
MyCircularQueue.prototype.isFull = function () {
    return this.queue.length === this.size
};

var orderlyQueue = function (s, k) {
    if (k === 1) {
        let ans = s
        for (let i = 0; i < s.length; i++) {
            s = s.substring(1, s.length) + s.substring(0, 1)
            if (s < ans) {
                ans = s
            }
        }
        return ans
    } else {
        return [...s].sort().join("")
    }
};

/**
 * @param {number[]} nums
 * @return {number[]}
 */
var minSubsequence = function (nums) {
    nums.sort((a, b) => b - a)
    let all = nums.reduce((a, b) => {
        return a + b
    })
    let curr = 0
    let ans = []
    for (let i = 0; i < nums.length; i++) {
        curr += nums[i]
        all -= nums[i]
        ans.push(nums[i])
        if (curr > all) {
            break
        }
    }
    return ans
};

/**
 * @param {TreeNode} root
 * @param {number} val
 * @param {number} depth
 * @return {TreeNode}
 */
var addOneRow = function (root, val, depth) {
    if (depth === 1) {
        return new TreeNode(val, root, null)
    } else {
        let queue = [root]
        let step = 1
        while (step < depth && queue.length > 0) {
            let length = queue.length;
            for (let i = 0; i < length; i++) {
                let treeNode = queue[i];
                if (step === depth - 1) {
                    let left = treeNode.left;
                    let right = treeNode.right;
                    treeNode.left = new TreeNode(val, left, null)
                    treeNode.right = new TreeNode(val, null, right)
                } else {
                    if (treeNode.left != null) queue.push(treeNode.left)
                    if (treeNode.right != null) queue.push(treeNode.right)
                }
            }
            queue.slice(length, queue.length)
            step++
        }
    }
};

/**
 * @param {string[]} words
 * @return {string[]}
 */
var stringMatching = function (words) {
    words.sort((a, b) => a.length - b.length)
    let ans = []
    let set = new Set()
    for (let i = 0; i < words.length; i++) {
        for (let j = i + 1; j < words.length; j++) {
            for (let k = 0; k <= words[j].length - words[i].length; k++) {
                let s = words[j].substring(k, words[i].length + k)
                if (s === words[i]) {
                    if (!set.has(words[i])) {
                        set.add(words[i])
                        ans.push(words[i])
                    }
                    break
                }
            }
        }
    }
    return ans
};

/**
 * @param {number} n
 * @param {string[]} logs
 * @return {number[]}
 */
var exclusiveTime = function (n, logs) {
    let array = new Array(n);
    array.fill(0)
    let stack = []
    for (let i = 0; i < logs.length; i++) {
        let strings = logs[i].split(":");
        let n = Number(strings[0])
        let t = Number(strings[1])
        if (strings[1] === "start") {
            stack.push([n, t])
        } else {
            let pop = stack.pop();
            array[pop[0]] += t - pop[1] + 1
            if (stack.length > 0) {
                array[stack[stack.length - 1][0]] -= t - pop[1] + 1
            }
        }
    }
    return array
};

/**
 * @param {number[]} nums
 * @return {number}
 */
var minStartValue = function (nums) {
    let ans = 1
    let all = ans
    let index = 0
    while (index < nums.length) {
        all += nums[index]
        if (all < 1) {
            ans++
            index = 0
            all = ans
        } else {
            index++
        }
    }
    return ans
};

/**
 * @param {string} s
 * @return {string}
 */
var reformat = function (s) {
    let num = [];
    let c = [];
    for (let i = 0; i < s.length; i++) {
        if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {
            num = [...num, s.charAt(i)]
        } else {
            c = [...c, s.charAt(i)]
        }
    }
    if (Math.abs(num.length - c.length) > 1) {
        return "";
    }
    let ans = ""
    let n1 = 0;
    let c1 = 0;
    for (let i = 0; i < s.length; i++) {
        if (i % 2 === 0) {
            ans += (num.length >= c.length() ? num[n1++] : c[c1++]);
        } else {
            ans += (c.length <= num.length() ? c[c1++] : num[n1++]);
        }
    }
    return ans;
};

/**
 * @param {number[]} groupSizes
 * @return {number[][]}
 */
var groupThePeople = function (groupSizes) {
    let ans = []
    let m = new Map();
    groupSizes.forEach((i, index) => {
        if(!m.has(i)){
            m[i] = [index]
        }else {
            let list = m[i]
            list=[...list,i]
            m[i] = list
        }
    })
    for (let [key, value] of m) {
        let index = 0
        for (let i = 0; i < value.length / key && index<value.length; i++) {
            let list = []
            for (let j = 0; j < key; j++) {
                list = [...list,value[index++]]
            }
            ans = [...ans,list]
        }
    }
    return ans
};

/**
 * @param {number} k
 */
var MyCircularDeque = function(k) {
        this.queue = []
        this.length = k
    };

/**
 * @param {number} value
 * @return {boolean}
 */
MyCircularDeque.prototype.insertFront = function(value) {
    if (this.isFull()){
        return false
    }
    this.queue = [value,...this.queue]
    return true
};

/**
 * @param {number} value
 * @return {boolean}
 */
MyCircularDeque.prototype.insertLast = function(value) {
    if (this.isFull()){
        return false
    }
    this.queue = [...this.queue,value]
    return true
};

/**
 * @return {boolean}
 */
MyCircularDeque.prototype.deleteFront = function() {
    if (this.isEmpty()){
        return false
    }
    this.queue.shift()
    return true
};

/**
 * @return {boolean}
 */
MyCircularDeque.prototype.deleteLast = function() {
    if (this.isEmpty()){
        return false
    }
    this.queue.pop()
    return true
};

/**
 * @return {number}
 */
MyCircularDeque.prototype.getFront = function() {
    if (this.isEmpty()){
        return -1
    }
    return this.queue[0]
};

/**
 * @return {number}
 */
MyCircularDeque.prototype.getRear = function() {
    if (this.isEmpty()){
        return -1
    }
    return this.queue[this.queue.length-1]
};

/**
 * @return {boolean}
 */
MyCircularDeque.prototype.isEmpty = function() {
    return this.queue.length === 0
};

/**
 * @return {boolean}
 */
MyCircularDeque.prototype.isFull = function() {
    return this.queue.length === this.length
};


/**
 * @param {number} n
 */
var OrderedStream = function(n) {
    this.size = n
    this.index = 1
    this.map = new Map()
};

/**
 * @param {number} idKey
 * @param {string} value
 * @return {string[]}
 */
OrderedStream.prototype.insert = function(idKey, value) {
    this.map.set(idKey,value)
    let ans = []
    while (this.index<=this.size){
        if(!this.map.has(this.index)){
            break
        }
        ans.push(this.map.get(this.index++))
    }
    return ans
};

/**
 * Your OrderedStream object will be instantiated and called as such:
 * var obj = new OrderedStream(n)
 * var param_1 = obj.insert(idKey,value)
 */

/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var deepestLeavesSum = function(root) {
    let ans = 0
    let queue = []
    while (queue.length>0){
        let sum = 0
        let size = queue.length
        for (let i = 0; i < size; i++) {
            let shift = queue.shift();
            sum += shift.val
            if(shift.left!=null){
                queue.push(shift.left)
            }
            if(shift.right!=null){
                queue.push(shift.right)
            }
        }
        if (queue.length===0){
            ans = sum
        }
    }
    return ans
};

/**
 * @param {number[]} startTime
 * @param {number[]} endTime
 * @param {number} queryTime
 * @return {number}
 */
var busyStudent = function(startTime, endTime, queryTime) {
    let ans = 0
    for (let i = 0; i < startTime.length; i++) {
        if(startTime[i]<=queryTime && endTime[i]>=queryTime){
            ans++
        }
    }
    return ans
};
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {number[]} nums
 * @return {TreeNode}
 */
var constructMaximumBinaryTree = function(nums) {
    function dfs(left,right,nums){
        if(left>right){
            return null
        }
        let max = left
        for (let i = left; i <= right; i++) {
            if(nums[i]>nums[max]){
                max = i
            }
        }
        let node = new TreeNode(nums[max])
        node.left = dfs(left,max-1,nums)
        node.right = dfs(max+1,right,nums)
        return node
    }
    return dfs(0,nums.length-1,nums)
};
/**
 * @param {string} sentence
 * @param {string} searchWord
 * @return {number}
 */
var isPrefixOfWord = function(sentence, searchWord) {
    let strings = sentence.split(" ");
    for (let i = 0; i < strings.length; i++) {
        if(strings[i].startsWith(searchWord)){
            return i+1
        }
    }
    return -1
};
/**
 * @param {number[]} target
 * @param {number[]} arr
 * @return {boolean}
 */
var canBeEqual = function(target, arr) {
    let map = new Map()
    target.forEach(i=>{
        if(map.has(i)){
            map.set(i,map.get(i)+1)
        }else {
            map.set(i,1)
        }
    })
    for (let i = 0; i < arr.length; i++) {
        if(!map.has(arr[i]) || map.get(arr[i])<=0){
            return false
        }
        map.set(arr[i],map.get(arr[i])-1)
    }
    return true
};

/**
 * @param {number[]} arr
 * @param {number} k
 * @param {number} x
 * @return {number[]}
 */
var findClosestElements = function(arr, k, x) {
    arr.sort((a,b)=>{
        if (Math.abs(a-x)!==Math.abs(b-x)){
            return Math.abs(a-x)<Math.abs(b-x)
        }else {
            return a-b
        }
    })
    arr.slice(0,k)
    arr.sort()
    return arr
};

/**
 * @param {number[]} nums
 * @param {number} n
 * @return {number[]}
 */
var shuffle = function(nums, n) {
    let ans = []
    for (let i = 0; i <nums.length/2; i++) {
        ans.push(nums[i])
        ans.push(nums[n++])
    }
    return ans
};

/**
 * @param {number[]} nums
 * @return {number}
 */
var maxProduct = function(nums) {
    nums.sort((a,b)=>a-b)
    return (nums[nums.length-1]-1) * (nums[nums.length-2]-1)
};

/**
 * @param {number[]} prices
 * @return {number[]}
 */
var finalPrices = function(prices) {
    for (let i = 0; i < prices.length; i++) {
        for (let j = i+1; j < prices.length; j++) {
            if(prices[i]>=prices[j]){
                prices[i]= prices[i]-prices[j];
                break;
            }
        }
    }
    return prices
};

/**
 * @param {number[][]} mat
 * @return {number}
 */
var numSpecial = function(mat) {
    let ans = 0;
    let m = mat.length
    let n = mat[0].length
    let rows = new Array(m);
    let cols = new Array(n);
    Array.fill(rows,0)
    Array.fill(cols,0)
    for (let i = 0; i < mat.length; i++) {
        for (let j = 0; j < mat[i].length; j++) {
            if(mat[i][j]===1){
                rows[i]+=1;
                cols[j]+=1;
            }
        }
    }
    for (let i = 0; i < mat.length; i++) {
        for (let j = 0; j < mat[i].length; j++) {
            if(rows[i]===1 && cols[j]===1 && mat[i][j]===1){
                ans++;
            }
        }
    }
    return ans;
};

/**
 * @param {number} num
 * @return {number}
 */
var maximumSwap = function(num) {
    let strings = `${num}`.split('');
    let max = num
    for (let i = 0; i < strings.length; i++) {
        for (let j = 0; j < strings.length; j++) {
            let temp = strings[i]
            strings[i] = strings[j]
            strings[j] = temp
            max = Math.max(max,Number(strings.join('')))
            strings[j] = strings[i]
            strings[i] = temp
        }
    }
    return num
};
/**
 * @param {number[]} arr
 * @return {number}
 */
var trimMean = function(arr) {
    arr.sort((a,b)=>a-b)
    let all = 0
    let sum = 0
    let s = arr.length /20
    let e = arr.length *19 /20
    for (let i = s; i < e; i++) {
        all += arr[i]
        sum ++
    }
    return all / sum
};

/**
 * @param {string} s
 * @return {number}
 */
var maxLengthBetweenEqualCharacters = function(s) {
    let strings = s.split('');
    let ans = -1
    let map = new Map()
    for (let i = 0; i < strings.length; i++) {
        let index = i
        if(!map.has(strings[i])){
            map.set(strings[i],i)
        }else {
            index = map.get(strings[i])
        }
        ans = Math.max(i-index -1,ans)
    }
    return ans
};